﻿using OF.Component.BLL;
using OF.Component.Model;
using OF.Utility;
using OpSystem.common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace OpSystem
{
    public partial class ResetPassword : BasePage
    {
        public string Message = "";
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string oldpass = SecurityUtility.EncryptAsc(this.oldpass.Value);
            string userPass = SecurityUtility.EncryptAsc(this.userpass.Value);
           
            if (CurrentUser != null)
            {
                AuthorityUserInforInfo info = AuthorityUserInforOperate.GetByID(CurrentUser.UserId);
                if (info != null)
                {
                    if (info.PassWord == oldpass)
                    {
                        info.PassWord = userPass;
                        AuthorityUserInforOperate.Update(info);
                        Message = " BMCW.msg(\"更新密码成功！\",\"ResetPassword.aspx\");";
                    }
                    else
                    {
                        Message = " BMCW.alert('用户密码输入错误！');";
                    }
                }
            }
            else
            {
                Message = " BMCW.alert('用户登陆超时,请退出重新登陆！');";
            }
        }
    }
}